import { request } from '@/api/service'
export const urlPrefix = '/api/dataStatistics/'
export const urlPrefix_local = 'http://127.0.0.1:8099/api/dataStatistics/'
/**
 * 列表查询
 */
export function defectDataGetList(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectForm',
        method: 'get',
        params: query
    })
}
export function defectDataFilterGetList(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectDataFilter',
        method: 'get',
        params: query
    })
}
export function defectDataBatchFilterGetList(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectDataBatchFilter',
        method: 'get',
        params: query
    })
}
//地图
export function defectMapFilter(query) {
    // query.page = 3
    // query.limit = 999
    return request({
        url: urlPrefix + 'defectMapFilter',
        method: 'get',
        params: query
    })
}

/**
 * 修改
 */
export function UpdateDefectData(obj) {
    return request({
        url: urlPrefix + "defectForm/" + obj.id + '/',
        method: 'put',
        data: obj
    })
}


/**
 * 删除
 */
export function DelDefectData(id) {
    return request({
        url: urlPrefix + 'defectForm/' + id + '/',
        method: 'delete',
        data: { id }
    })
}

/**
 * 新增
 */
export function createDefectData(obj) {
    return request({
        url: urlPrefix + "defectForm/",
        method: 'post',
        data: obj
    })
}


/**
 * 瑕疵图片路径
 */
export function getDefectImagePath(obj) {
    return request({
        url: urlPrefix + "readDefectImage",
        method: 'get',
        data: obj
    })
}

/**
 * 读取文件夹信息
 */
export function defectReadDir(obj) {
    return request({
        url: urlPrefix + "defectReadDir",
        method: 'get',
        data: obj
    })
}

/**
 * 删除文件夹
 */
export function defectDelDir(query) {
    return request({
        url: urlPrefix + "defectDelDir",
        method: 'get',
        params: query
    })
}

/**
 * 所有订单号和卷号查询
 */
export function defectallBatchReel(query){
    return request({
        url: urlPrefix + 'defectallBatchReel',
        method: 'get',
        params: query
    })
}

/**
 * 根据图片名称获取瑕疵图片
 */
export function defectGetImageByName(query) {
    return request({
        url: urlPrefix + "defectGetImageByName",
        method: 'get',
        params: query
    })
}

/**
 * 拼接图片url
 */
export function defectImageUrl(str){
    return urlPrefix_local + 'defectGetImageByName?imgPath=' + str
}

/**
 * 获取自动删除天数
 */
export function defectGetDelDay(query) {
    return request({
        url: urlPrefix + "defectGetDelDay",
        method: 'get',
        params: query
    })
}

/**
 * 设置自动删除天数
 */
export function defectSetDelDay(query) {
    return request({
        url: urlPrefix + "defectSetDelDay",
        method: 'get',
        params: query
    })
}
